home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / gfx / 3d / irit50src.lha / irit5 / scripts / coords.irt < prev    next >
Encoding:
Text File  |  1994-09-17  |  3.6 KB  |  150 lines

  1. #
  2. # Some tests to the COORD and COERCE commands.
  3. #
  4.  
  5. a = point( 1, 2, 3 );
  6. point( coord( a, 0 ), coord( a, 1 ), coord( a, 2 ) );
  7.  
  8. a = vector( 4, 5, 6);
  9. vector( coord( a, 0 ), coord( a, 1 ), coord( a, 2 ) );
  10.  
  11. a = plane( 10, 11, 12, 13 );
  12. plane( coord( a, 0 ), coord( a, 1 ), coord( a, 2 ), coord( a, 3 ) );
  13.  
  14. #
  15. # On lists, it does what NTH is doing.
  16. #
  17. a = list( 11, 12.5, PI );
  18. coord( a, 3 );
  19.  
  20. #
  21. # On a matrix, it extract a single number (out of 4 by 4 = 16)
  22. #
  23. view_mat;
  24. coord( view_mat, 0 );
  25. coord( view_mat, 2 );
  26. coord( view_mat, 15 );
  27.  
  28. #
  29. # Note that the zero location is reserved for the weights in CTLPT;
  30. #
  31. a = ctlpt( E2, 1, 2 );
  32. ctlpt( E2, coord( a, 1 ), coord( a, 2 ) );
  33.  
  34. a = ctlpt( E3, 3, 4, 5 );
  35. ctlpt( E3, coord( a, 1 ), coord( a, 2 ), coord( a, 3 ) );
  36.  
  37. a = ctlpt( P2, 6, 7, 8 );
  38. ctlpt( P2, coord( a, 0 ), coord( a, 1 ), coord( a, 2 ) );
  39.  
  40. a = ctlpt( P3, 9, 10, 11, 12 );
  41. ctlpt( P3, coord( a, 0 ), coord( a, 1 ), coord( a, 2 ), coord( a, 3 ) );
  42.  
  43. #
  44. # From polygons/lines it extracts a poly if more than one poly
  45. # is in the list or a vertex from the poly if only one poly is found.
  46. #
  47. iritState("DumpLevel", 9);
  48. axes;
  49. coord( axes, 2 );
  50. coord( coord( axes, 2 ), 1 );
  51. iritState("DumpLevel", 1);
  52.  
  53. #
  54. # From a curve and surface, it extracts a control point.
  55. #
  56. s45 = sin( pi / 4 );
  57. cbzr = list( ctlpt( P2, 1.0, 1.0, 0.0 ),
  58.          ctlpt( P2, s45, s45, s45 ),
  59.          ctlpt( P2, 1.0, 0.0, 1.0 ) );
  60. sbsp = list ( list( ctlpt( E3, 0.1, 0.0, 1.0 ),
  61.                 ctlpt( E3, 0.3, 1.0, 0.0 ),
  62.                 ctlpt( E3, 0.0, 2.0, 1.0 ) ),
  63.               list( ctlpt( E3, 3.1, 0.0, 0.0 ),
  64.                 ctlpt( E3, 3.3, 1.0, 2.0 ),
  65.                 ctlpt( E3, 3.0, 2.0, 0.0 ) ),
  66.               list( ctlpt( E3, 4.1, 0.0, 1.0 ),
  67.                 ctlpt( E3, 4.3, 1.0, 0.0 ),
  68.                 ctlpt( E3, 4.0, 2.0, 1.0 ) ) );
  69.  
  70. cb = cbezier( cbzr );
  71. sb = sbspline( 3, 3, sbsp, list( list( 1, 1, 1, 2, 2, 2 ),
  72.                  list( KV_OPEN ) ) );
  73.  
  74. coord( cb, 1 );
  75. coord( sb, 0 );
  76. coord( sb, 1 );
  77. coord( sb, 8 );
  78.  
  79. #
  80. # And now the COERCE command.
  81. #
  82. a = vector(1, 2, 3 );
  83. coerce( a, point_type );
  84. coerce( a, plane_type );
  85. coerce( a, e2 );
  86. coerce( a, e5 );
  87. coerce( a, p2 );
  88. coerce( a, p3 );
  89.  
  90. a = plane(10, 11, 12, 13 );
  91. coerce( a, point_type );
  92. coerce( a, vector_type );
  93. coerce( a, e1 );
  94. coerce( a, e4 );
  95. coerce( a, p1 );
  96. coerce( a, p5 );
  97.  
  98. a = ctlpt(e1, 1 );
  99. coerce( a, vector_type );
  100. coerce( a, point_type );
  101. coerce( a, plane_type );
  102. coerce( a, e3 );
  103. coerce( a, e5 );
  104. coerce( a, p2 );
  105. coerce( a, p3 );
  106.  
  107. a = ctlpt(p5, 0.7, 1, 2, 3, 4, 5 );
  108. coerce( a, vector_type );
  109. coerce( a, point_type );
  110. coerce( a, plane_type );
  111. coerce( a, e1 );
  112. coerce( a, e3 );
  113. coerce( a, p3 );
  114. coerce( a, p5 );
  115.  
  116. iritState("DumpLevel", 9);
  117. circ = circle( vector( 0.25, 0.5, 0.5 ), 1.5 );
  118. coerce( circ, e3 );
  119. coerce( circ, p4 );
  120.  
  121. srf = ruledSrf( cbezier( list( ctlpt( E3, -0.5, -0.5, 0.0 ),
  122.                    ctlpt( E3,  0.5, -0.5, 0.0 ) ) ),
  123.             cbezier( list( ctlpt( E3, -0.5,  0.5, 0.0 ),
  124.                    ctlpt( E3,  0.5,  0.5, 0.0 ) ) ) );
  125. coerce( srf, e5 );
  126. coerce( srf, p2 );
  127.  
  128. crv = cbspline( 3,
  129.         list( ctlpt( P2, 1.0, 1.0, 0.0 ),
  130.               ctlpt( P2, s45, s45, s45 ),
  131.               ctlpt( P2, 1.0, 0.0, 1.0 ) ),
  132.         list( KV_FLOAT ) );
  133. srf = sbspline( 3, 3,
  134.         list( list( ctlpt( E3, 0.1, 0.0, 1.0 ),
  135.                     ctlpt( E3, 0.3, 1.0, 0.0 ),
  136.                     ctlpt( E3, 0.0, 2.0, 1.0 ) ),
  137.                   list( ctlpt( E3, 3.1, 0.0, 0.0 ),
  138.                     ctlpt( E3, 3.3, 1.0, 2.0 ),
  139.                     ctlpt( E3, 3.0, 2.0, 0.0 ) ),
  140.                   list( ctlpt( E3, 4.1, 0.0, 1.0 ),
  141.                     ctlpt( E3, 4.3, 1.0, 0.0 ),
  142.                     ctlpt( E3, 4.0, 2.0, 1.0 ) ) ),
  143.         list( list( KV_FLOAT ),
  144.               list( KV_FLOAT ) ) );
  145.  
  146. coerce( crv, KV_OPEN );
  147. coerce( srf, KV_OPEN );
  148.  
  149. iritState("DumpLevel", 1);
  150.